<%--
	JSP page to gather credit card details of the user.

	Change Log
	----------
 	Oct 09,2006 Added the text field for gathering the Card Verification Value.
--%>

<%@ page import="java.util.*,merlin.beans.*,merlin.dao.*,merlin.managers.*,merlin.servlets.*,merlin.utils.*" errorPage="mr_errhandler.jsp" %>

<jsp:useBean id="autoFill" scope="session" class = "merlin.beans.AutoFillDetails"/>
<jsp:setProperty name="autoFill" property="*" />
<%!

	ApplicationResources resource = ApplicationResources.getInstance();

	String separatorString = resource.getProperty("separatorString");
	String separatorPattern = resource.getProperty("separatorPattern");

	public String getFormattedReportDetails(List lstReportNames){
		StringBuffer sbufReportDetails = new StringBuffer();

		StringBuffer tempBuffer = new StringBuffer();
		// change the array into uppercased "'" enclosed and comma separated
		// string which can be used in a SQL IN clause.
		for(int i=0;i<lstReportNames.size();i++){
			String strReportName = (String) lstReportNames.get(i);
			tempBuffer.append('\'').append(strReportName.substring(1).toUpperCase()).append('\'').append(',');
		}
		// remove the last ","
		tempBuffer.deleteCharAt(tempBuffer.length() - 1);

		String whereClause = "REPORT_TITLE IN (" + tempBuffer.toString() + ")";
		String orderBy = "REPORT_TITLE ASC";
		DbResultSet result = ReportTitlesManager.selectReportTitlesRecords(whereClause,orderBy);

		if(result != null && result.size() > 0){
  			int length = result.size();
  			for(int i=0;i< length - 1;i++){
  				ReportTitlesBean bean = (ReportTitlesBean)result.get(i);
      			sbufReportDetails.append(bean.getReportTitlesId()).append(separatorString).append(bean.getReportTitle()).append(separatorString);
  			}
  				ReportTitlesBean bean = (ReportTitlesBean)result.get(length - 1);
      			sbufReportDetails.append(bean.getReportTitlesId()).append(separatorString).append(bean.getReportTitle()).append(separatorString);
  		}

		return sbufReportDetails.toString();
	}

%>

<%
	// This additional code is used to format the data that may come from the enquiries.jsp page.
	// The enquiries.jsp page sends the data in the form of checkboxes whose names are the report names.
	// Each report name starts with the '-' character and the report names are in Title case.
 	Enumeration names = request.getParameterNames();
 	List list = new LinkedList();
 	while(names.hasMoreElements()){
 		String name = (String)names.nextElement();
 		if(name.charAt(0) =='-'){
 			// This is a report name.
 			list.add(name.substring(0));
 		}
 	}
 	// put the data into the request attribute which is used later on for autofilling the list box.
 	if(list.size() > 0){
	 	String strReportNames = getFormattedReportDetails(list);
 		request.setAttribute("hidSelectedReports",strReportNames);
 	}

%>

<html>
<head>
	<title>Payment Details</title>
	<script>
		<%
			HashMap mapConfigs = MsalResearchersManager.getAllConfigurationDetails();
			ApplicationResources resources = ApplicationResources.getInstance();
		%>
		var firstBookPrice           = <%= mapConfigs.get(resources.getProperty("FirstBookPrice")) %>;
		var firstDatabasePrice       = <%= mapConfigs.get(resources.getProperty("FirstDatabasePrice")) %>;
		var firstComboPrice          = <%= mapConfigs.get(resources.getProperty("FirstComboPrice")) %>;
		var subsequentBooksPrice     = <%= mapConfigs.get(resources.getProperty("SubsequentBooksPrice")) %>;
		var subsequentDatabasesPrice = <%= mapConfigs.get(resources.getProperty("SubsequentDatabasesPrice")) %>;
		var subsequentCombosPrice    = <%= mapConfigs.get(resources.getProperty("SubsequentCombosPrice")) %>;

    	function calculateTotalPrice(frm){
			try{
				var selectedReports = frm.lstSelectedReports;
				var numReports = selectedReports.length;

				var firstPrice;
				var subsequentPrice;
				var selectedOption;

				for (i = 0; i < frm.chkOptions.length; i++){
					if (document.frmCreditCardDetails.chkOptions[i].checked){
						selectedOption = document.frmCreditCardDetails.chkOptions[i].value;
						break;
					}
				}

				if(selectedOption == "Book(s) only"){
					firstPrice = firstBookPrice;
					subsequentPrice = subsequentBooksPrice;
				}else if(selectedOption == "Searchable Database(s) only"){
					firstPrice = firstDatabasePrice;
					subsequentPrice = subsequentDatabasesPrice;
				}else{
					document.frmCreditCardDetails.chkOptions[2].checked = true;	// to fix a bug that doenst check any radio button by default.
					firstPrice = firstComboPrice;
					subsequentPrice = subsequentCombosPrice;
				}

				var totalPrice = (numReports < 1 ? 0 : firstPrice + (subsequentPrice * (numReports - 1)));

				if (totalPrice.toFixed){ //if browser supports toFixed() method
					frm.edtTotal.value = totalPrice.toFixed(2);
				}else{
					frm.edtTotal.value = totalPrice;
				}
			}catch(e){
				alert("Error in calculateTotal(): " + e.message);
			}
		}

		function isBlank(str){
			var len = str.length;
			if(len==0)return true;	// zero-length string
			for(i=0;i<len;i++){
				if(str.charAt(i) !=' ' && str.charAt(i) !='\n')return false; //some character is there
			}
			return true;
		}

		//validate the format of the e-mail address
		function isValidateEMailFormat(aEMailAddress){
			//Check for an email with a .com or .net extension
			var emailcom = /^[a-z][a-z_0-9\.]+@[a-z_0-9\.]+\.[a-z]{3}$/i
			//Check for an email with a .co.uk extension
			var emailcouk = /^[a-z][a-z0-9_\.]+@[a-z0-9_\.]+\.[a-z][a-z]\.[a-z][a-z]$/i
			var TheEMailAddress = new String(aEMailAddress);
			var tmpemail = aEMailAddress;
			var tmpamount = 0;
			var onechars = '';
			//validate the email format
			if ((TheEMailAddress.match(emailcom)) && (TheEMailAddress.match(emailcouk))) {
				return(false);
			};

			//ensure that the e-mail address contains 1 '@'
			for(var p=0; p < tmpemail.length; p++){
				onechars = tmpemail.charAt(p);
				if (onechars == '@')
					tmpamount = tmpamount + 1;
			}//for

			if (tmpamount != 1) {
				return(false);
			}

			return(true);
		}


		function radSameDetailsClick(frm){
			//tblCardHolderDetails.style.visibility = (frm.radSameDetails[0].checked ? "hidden" : "visible");
			document.getElementById("tblCardHolderDetails").style.visibility = (frm.radSameDetails[0].checked ? "hidden" : "visible");
			/*
			if (creditcarddetails.innerHTML == "") {
				creditcarddetails.innerHTML = '<span class="greenText">Credit Card Details</span>';
				window.location = "#top";
			} else {
				creditcarddetails.innerHTML = "";
			}
			*/
		}

		function doRemoveSelected(frm){
			var idx = frm.lstSelectedReports.selectedIndex;
			if(idx != -1){
				if(confirm("Remove selected report?")){
					frm.lstSelectedReports.remove(idx);
					calculateTotalPrice(frm);
				}
			}
		}

		function doBack(frm){
			//return to the search page.
			var reportTitles ="";
			var lstLen = frm.lstSelectedReports.length;
			if(lstLen> 0){
   				for(i=0;i < lstLen - 1;i++){
					reportTitles += frm.lstSelectedReports.options[i].value + "<%= separatorString %>" + frm.lstSelectedReports.options[i].text + "<%= separatorString %>";
				}
				reportTitles += frm.lstSelectedReports.options[lstLen-1].value + "<%= separatorString %>" + frm.lstSelectedReports.options[lstLen-1].text;
			}
			frm.hidSelectedReports.value=reportTitles;

			//frm.action = '<%=request.getParameter("pageName")%>';
			frm.action="mr_searchReports.jsp";
			frm.submit();
		}

		function submitFormForOrder(frm){
			// sanity checks
			if(isBlank(frm.txtTitle.value)){
				alert("Title cannot be left blank");
				frm.txtTitle.focus();
				return;
			}
			if(isBlank(frm.txtFirstName.value)){
				alert("First Name cannot be left blank");
				frm.txtFirstName.focus();
				return;
			}
			if(isBlank(frm.txtSurname.value)){
				alert("Surname cannot be left blank");
				frm.txtSurname.focus();
				return;
			}
			if(isBlank(frm.txtPosition.value)){
				alert("Position cannot be left blank");
				frm.txtPosition.focus();
				return;
			}
			if(isBlank(frm.txtCompanyName.value)){
				alert("Company Name cannot be left blank");
				frm.CompanyName.focus();
				return;
			}

			if(isBlank(frm.txtEMailAddress.value)){
				alert("EMail Address cannot be left blank");
				frm.txtEMailAddress.focus();
				return;
			}
			if(! isValidateEMailFormat(frm.txtEMailAddress.value)){
				alert("EMail Address is not valid");
				frm.txtEMailAddress.focus();
				return;
			}
			// If the credit card details are different, check those values too
			if(frm.radSameDetails[1].checked){
				if(isBlank(frm.txtCardTitle.value)){
					alert("Title cannot be left blank");
					frm.txtCardTitle.focus();
					return;
				}
				if(isBlank(frm.txtCardForename.value)){
					alert("First Name cannot be left blank");
					frm.txtCardForename.focus();
					return;
				}
				if(isBlank(frm.txtCardSurname.value)){
					alert("Surname cannot be left blank");
					frm.txtCardSurname.focus();
					return;
				}
				if(isBlank(frm.txtCardPosition.value)){
					alert("Position cannot be left blank");
					frm.txtCardPosition.focus();
					return;
				}
				if(isBlank(frm.txtCardCompanyName.value)){
					alert("Company Name cannot be left blank");
					frm.CardCompanyName.focus();
					return;
				}
			}

			// verify the credit card details.
			if(isBlank(frm.txtCardNumber.value)){
				alert("Credit Card Number is required");
				frm.txtCardNumber.focus();
				return;
			}

			if(isBlank(frm.txtCVV.value)){
				alert("Credit Card Verification Number is required");
				frm.txtCVV.focus();
				return;
			}

			if(frm.cmbMonth.selectedIndex == 0){
				alert("Expiry month must be specified");
				frm.cmbMonth.focus();
				return;
			}

			if(frm.cmbYear.selectedIndex == 0){
				alert("Expiry Year must be specified");
				frm.cmbYear.focus();
				return;
			}

			// all is OK, submit the form.
			var reportTitles ="";
			var lstLen = frm.lstSelectedReports.length;
			if(lstLen> 0){
   				for(i=0;i < lstLen - 1;i++){
					reportTitles += frm.lstSelectedReports.options[i].value + "<%= separatorString %>" + frm.lstSelectedReports.options[i].text + "<%= separatorString %>";
				}
				reportTitles += frm.lstSelectedReports.options[lstLen-1].value + "<%= separatorString %>" + frm.lstSelectedReports.options[lstLen-1].text;
			}
			frm.hidSelectedReports.value=reportTitles;
			frm.mode.value="saveNewPaymentDetails";
			frm.action = "merlin";
			frm.submit();
		}

	</script>

</head>

<body>
    <jsp:include page="mr_header.jsp"/>
    <p/>
	<table align="center" width="750px" border="0">
		<tr>
			<td colspan="2" align="center" style='color:white;height:23px;font: 11px verdana,arial, sans-serif ;background:url("mr_images/LongBars-orange750.jpg") no-repeat;' >
				<h4 style="vertical-align:middle">Your Details</h4>
			</td>
		</tr>
	</table>
	<div align="center">

	<table cellpadding="0" cellspacing="0" style="width: 750px;	font-family: Verdana, Helvetica, Arial, sans-serif;font-size: 11px;">
		<%
			String errorMessage = autoFill.getErrorMessage();
			if(errorMessage != null && errorMessage.length() > 0){
		%>
			<tr>
				<td><span style="color: red"><%= errorMessage %></span></td>
			</tr>
		<%
				autoFill.setErrorMessage(null);
			}
		%>
		<tr>
			<td>
				<form name="frmCreditCardDetails" method="post" action="merlin" >

					<input type="hidden" name="mode" value="saveNewOrder">
					<input type="hidden" name="hidSelectedReports" value="">
					<input type="hidden" name="emailSubject" value='New Order From <%=request.getParameter("emailFrom")%>'>

					<table style="width: 750px;	font-family: Verdana, Helvetica, Arial, sans-serif;font-size: 11px;">
						<tr>
							<td width="50%">&nbsp;</td>
							<td width="50%">
								<!-- SECURE SEAL WILL GO HERE -->
<script type="text/javascript" src="https://seal.thawte.com/getthawteseal?host_name=www.merlinscottassociates.co.uk&amp;size=M&amp;lang=en"></script>							
</td>
						</tr>
						<tr>
							<td width="50%">
								<table cellpadding="0" cellspacing="0" style="font-family: Verdana, Helvetica, Arial, sans-serif;font-size: 11px;">
									<tr>
										<td style="width: 150px;">&nbsp;</td>
										<td style="width: 200px;">&nbsp;</td>
									</tr>
									<tr>
										<td style="width: 150px;">&nbsp;</td>
										<td style="width: 200px;"><span class="boldGreen">Delivery Details</span></td>
									</tr>
									<tr>
										<td><span style="color: #B1730C;">*</span> Title (Mr/Mrs/Dr etc)</td>
										<td><input type="text" name="txtTitle" style="width: 50px;" value='<jsp:getProperty name="autoFill" property="txtTitle"/>'></td>
									</tr>
									<tr>
										<td><span style="color: #B1730C;">*</span> First Name</td>
										<td><input type="text" name="txtFirstName" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtFirstName"/>'></td>
									</tr>
									<tr>
										<td><span style="color: #B1730C;">*</span> Surname</td>
										<td><input type="text" name="txtSurname" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtSurname"/>'></td>
									</tr>
									<tr>
										<td><span style="color: #B1730C;">*</span> Position (eg Director)</td>
										<td><input type="text" name="txtPosition" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtPosition"/>'></td>
									</tr>
									<tr>
										<td><span style="color: #B1730C;">*</span> Company Name</td>
										<td><input type="text" name="txtCompanyName" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtCompanyName"/>'></td>
									</tr>
									<tr>
										<td><span style="color: white;">*</span> Address Line 1</td>
										<td><input type="text" name="txtAddress1" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtAddress1"/>'></td>
									</tr>
									<tr>
										<td><span style="color: white;">*</span> Address Line 2</td>
										<td><input type="text" name="txtAddress2" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtAddress2"/>'></td>
									</tr>
									<tr>
										<td><span style="color: white;">*</span> Town</td>
										<td><input type="text" name="txtTown" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtTown"/>'></td>
									</tr>
									<tr>
										<td><span style="color: white;">*</span> County</td>
										<td><input type="text" name="txtCounty" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtCounty"/>'></td>
									</tr>
									<tr>
										<td><span style="color: white;">*</span> Postcode</td>
										<td><input type="text" name="txtPostcode" style="width: 100px;" value='<jsp:getProperty name="autoFill" property="txtPostcode"/>'></td>
									</tr>
									<tr>
										<td><span style="color: white;">*</span> Telephone</td>
										<td><input type="text" name="txtTelephone" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtTelephone"/>'></td>
									</tr>
									<tr>
										<td><span style="color: #B1730C;">*</span> Email Address</td>
										<%
											// A complicated situation here :
											// The email address can come from either the user typing it or being retrieved
											// from the database for an existing user . So both validations will be checked,
											// with the user-filled email taking precedence.
											String emailAddress = (String)session.getAttribute("emailAddress");
											if(autoFill.getTxtEMailAddress() != null && autoFill.getTxtEMailAddress().length() > 0){
												emailAddress = autoFill.getTxtEMailAddress();
											}
											if(emailAddress == null) emailAddress = "";
										%>
										<td><input type="text" name="txtEMailAddress" value='<%= emailAddress %>' style="width: 150px;"></td>
									</tr>
								</table>
							</td>
				  			<td width="50%">
								<!-- table for cardholder details if different -->
								<%
									String cardDetailsVisiblity = "F".equals(autoFill.getRadSameDetails()) ? "visible" : "hidden" ;
								%>
								<table width="100%" cellpadding="0" cellspacing="0" name="tblCardHolderDetails" style="visibility: <%= cardDetailsVisiblity %>;font-family: Verdana, Helvetica, Arial, sans-serif;font-size: 11px;" id="tblCardHolderDetails">
									<tr>
										<td width="306">&nbsp;</span></td>
									</tr>
									<tr>
										<td width="306">&nbsp;</span><span class="boldGreen">Card Address </span></td>
									</tr>
									<tr>
										<td width="306"><input type="text" name="txtCardTitle" style="width: 50px;" value='<jsp:getProperty name="autoFill" property="txtCardTitle"/>'></td>
									</tr>
									<tr>
										<td width="306"><input type="text" name="txtCardForename" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtCardForename"/>'></td>
									</tr>
									<tr>
										<td width="306"><input type="text" name="txtCardSurname" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtCardSurname"/>'></td>
									</tr>
									<tr>
										<td width="306"><input type="text" name="txtCardPosition" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtCardPosition"/>'></td>
									</tr>
									<tr>
										<td width="306"><input type="text" name="txtCardCompanyName" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtCardCompanyName"/>'></td>
									</tr>
									<tr>
										<td width="306"><input type="text" name="txtCardAddress1" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtCardAddress1"/>'></td>
									</tr>
									<tr>
										<td width="306"><input type="text" name="txtCardAddress2" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtCardAddress2"/>'></td>
									</tr>
									<tr>
										<td width="306"><input type="text" name="txtCardTown" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtCardTown"/>'></td>
									</tr>
									<tr>
										<td width="306"><input type="text" name="txtCardCounty" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtCardCounty"/>'></td>
									</tr>
									<tr>
										<td width="306"><input type="text" name="txtCardPostcode" style="width: 100px;" value='<jsp:getProperty name="autoFill" property="txtCardPostcode"/>'></td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td width="50%">&nbsp;</td>
							<td width="50%">&nbsp;</td>
						</tr>
						<tr>
							<td>
								<table cellpadding="0" cellspacing="0" style="font-family: Verdana, Helvetica, Arial, sans-serif;font-size: 11px;">
									<tr>
										<td height="22" style="width: 150px;">&nbsp;</td>
										<td height="22" style="width: 200px;">&nbsp;</td>
									</tr>
									<tr>
										<td><span style="color: #B1730C;">*</span> Credit Card Type</td>
										<td>
											<select size="1" name="cmbCreditCardType" style="width: 150px;">
												<option value="VISA">Visa</option>
												<option value="MC">Mastercard</option>
												<option value="AMEX">Amex</option>
											</select>
										</td>
									</tr>
									<tr>
										<td>
											<span style="color: #B1730C;">*</span> Credit Card Number
										</td>
										<td>
											<input type="text" name="txtCardNumber" style="width: 150px;" value='<jsp:getProperty name="autoFill" property="txtCardNumber"/>'>
										</td>
									</tr>
									<tr>
										<td>
											<span style="color: #B1730C;">*</span>  Credit Card Verification Number (Last 3 or 4 digits) from the rear of the card </td>
										<td>
											<input type="text" name="txtCVV" style="width: 50px;" value='<jsp:getProperty name="autoFill" property="txtCVV"/>'>
										</td>
									</tr>
									<tr>
										<td><span style="color: #B1730C;">*</span> Expiry Date</td>
										<td>
											<%
												String month = autoFill.getCmbMonth();
											%>
											<select size="1" name="cmbMonth">
												<option></option>
												<option <%= "01".equals(month) ? "selected" : "" %>>01</option>
												<option <%= "02".equals(month) ? "selected" : "" %>>02</option>
												<option <%= "03".equals(month) ? "selected" : "" %>>03</option>
												<option <%= "04".equals(month) ? "selected" : "" %>>04</option>
												<option <%= "05".equals(month) ? "selected" : "" %>>05</option>
												<option <%= "06".equals(month) ? "selected" : "" %>>06</option>
												<option <%= "07".equals(month) ? "selected" : "" %>>07</option>
												<option <%= "08".equals(month) ? "selected" : "" %>>08</option>
												<option <%= "09".equals(month) ? "selected" : "" %>>09</option>
												<option <%= "10".equals(month) ? "selected" : "" %>>10</option>
												<option <%= "11".equals(month) ? "selected" : "" %>>11</option>
												<option <%= "12".equals(month) ? "selected" : "" %>>12</option>
											</select>
											<%
												String year = autoFill.getCmbYear();
											%>
											&nbsp;
											<select size="1" name="cmbYear">
												<option></option>
												<option value="05" <%= "05".equals(year) ? "selected" : "" %>>2005</option>
												<option value="06" <%= "06".equals(year) ? "selected" : "" %>>2006</option>
												<option value="07" <%= "07".equals(year) ? "selected" : "" %>>2007</option>
												<option value="08" <%= "08".equals(year) ? "selected" : "" %>>2008</option>
												<option value="09" <%= "09".equals(year) ? "selected" : "" %>>2009</option>
												<option value="10" <%= "10".equals(year) ? "selected" : "" %>>2010</option>
												<option value="11" <%= "11".equals(year) ? "selected" : "" %>>2011</option>
												<option value="12" <%= "12".equals(year) ? "selected" : "" %>>2012</option>
												<option value="13" <%= "13".equals(year) ? "selected" : "" %>>2013</option>
												<option value="14" <%= "14".equals(year) ? "selected" : "" %>>2014</option>
												<option value="15" <%= "15".equals(year) ? "selected" : "" %>>2015</option>
											</select>
										</td>
									</tr>
									<tr>
										<td>
											<span style="color: #B1730C;">*</span> Cardholder details<br />
											<span style="color: white;">*</span> are as above?
										</td>
										<td>
											<input type="radio" name="radSameDetails" value="T" <%= cardDetailsVisiblity.equals("hidden")? "checked" : "" %> onclick="radSameDetailsClick(this.form)">Yes
                      						<input type="radio" name="radSameDetails" value="F" <%= cardDetailsVisiblity.equals("visible")? "checked" : "" %> onclick="radSameDetailsClick(this.form)">No
										</td>
									</tr>
								</table>
							<!-- Credit Card Details (Card Options NOT Address) -->
							</td>
              				<td>
							<!-- Credit Card Details (Card Options NOT Address) -->
								<table cellpadding="0" cellspacing="0" style="font-family: Verdana, Helvetica, Arial, sans-serif;font-size: 11px;">
									<tr>
										<td style="width: 350px;"><span class="greenText">Reports Being Ordered</span></td>
									</tr>
									<tr>
										<td style="padding: 6px 0px 4px 0px;">
											<select name="lstSelectedReports" MULTIPLE style="width: 200" size="4">
											<%
								  				// look for "hidSelectedReports" in both request.getAttribute() & request.getParameter()
			  									String selectedReports = request.getParameter("hidSelectedReports");
									  			if(selectedReports == null){
			  										selectedReports = (String) request.getAttribute("hidSelectedReports");
									  			}
												if(selectedReports != null && selectedReports.length() > 0){
											  		String array[] = selectedReports.split(separatorPattern);
											  		int tokens = array.length;
													for(int i=0;i<tokens - 1;i+=2){
											  			String reportNumber = array[i];
											  			String reportName = array[i + 1];
											     		out.println("<option value=\"" + reportNumber + "\">" + reportName + "</option>");
											  		}
												}
											%>
											</select><br />
											<%
												String purchaseType = autoFill.getChkOptions();
											%>
											<input type="radio" name="chkOptions" <%= (purchaseType == null || "Book(s) only".equals(purchaseType))? "checked" : ""%> value="Book(s) only" onclick="calculateTotalPrice(this.form)">Book(s) only</input><br />
											<input type="radio" name="chkOptions" <%= ("Searchable Database(s) only".equals(purchaseType))? "checked" : ""%> value="Searchable Database(s) only" onclick="calculateTotalPrice(this.form)">Searchable Database(s) only</input><br />
											<input type="radio" name="chkOptions" <%= ("Book(s) and database(s)".equals(purchaseType))? "checked" : ""%> value="Book(s) and database(s)" onclick="calculateTotalPrice(this.form)">Book(s) and database(s)</input>
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td colspan="2">
								<input name="btnBack" class="input" value="Search More Reports" style="font-size: 11px; width: 130px;" onclick="doBack(this.form)" type="button">
								<input name="btnRemove" class="input" value="Remove Selected" style="font-size: 11px; width: 130px;" onclick="doRemoveSelected(this.form)" type="button">
								<input name="btnSend" type="button" class="input" value="Order the Reports" style="font-size: 11px; width: 130px;" onclick="submitFormForOrder(this.form)">
								&nbsp;<span>Total:</span>&nbsp;<input type="text" name="edtTotal" readonly="true" style="width: 187px;" value="">
							</td>
						</tr>
					</table>
				</form>
			</div>
		</td>
	</tr>
	</table>
	<script language="JavaScript">
		calculateTotalPrice(document.frmCreditCardDetails);
	</script>
	<jsp:include page="mr_footer.jsp"/>
</body>

</html>
